import { createStore } from 'vuex'
export default createStore({
  state: {
    themeColor: true,
    username: "",
    isLogin: false,
    menus: [],
    addSuccess: false
  },
  getters: {
  },
  mutations: {
    changeThemeColor(state) {
      state.themeColor = !state.themeColor
    },

    changeLoginUser(state, value) {

      state.username = value
      state.isLogin = true
    },
    ConcatMenuArr(state, value) {
      state.menus = value
    },
    changeAddSuccess(state, value) {
      if (value) {
        state.addSuccess = true
      }else{
        state.addSuccess = false
      }
    }
  },
  actions: {

    CommitActions(context) {
      setTimeout(() => {
        context.commit("changeThemeColor")
      }, 888);
    },

    ConcatMenuArrAsync(context, value) {
      context.commit("ConcatMenuArr", value)
    }

  },
  modules: {
  }
})
